//
//  NSDictionary+Extension.m
//  GameSDK
//
//  Created by Johnny on 2017/8/23.
//  Copyright © 2017年 Johnny. All rights reserved.
//

#import "NSDictionary+Extension.h"
#import "YYKit.h"
@implementation NSDictionary (Extension)

- (NSString*)compare {
    NSArray *array = [[self allKeys] sortedArrayUsingSelector:@selector(compare:)];
    NSMutableString * valueString = [[NSMutableString alloc] initWithFormat:@""];
    for (int i=0; i<[array count]; i++) {
        NSString * string = self[array[i]];
        if (i == [array count] - 1) {
            [valueString appendFormat:@"%@=%@",array[i],  [string stringByURLEncode]];
        } else {
            [valueString appendFormat:@"%@=%@&",array[i], [string stringByURLEncode]];
        }
    }
    return valueString;
}
@end
